package com.zzl.bonds.ticket.dto.finance;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.zzl.apidoc.annotation.ApidocModel;
import com.zzl.apidoc.annotation.ApidocModelProperty;
import com.zzl.bonds.ticket.constant.type.PaymentModeEnum;
import com.zzl.bonds.ticket.entity.TicketDataEntity;
import com.zzl.general.common.utils.DoubleSerialize;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 我的票据 业务信息
 *
 * @author : spp
 * @date : 2022/2/25 15:38
 */
@Data
@ApidocModel
public class MyTicketDetailDto {
    @ApidocModelProperty(description = "主键")
    private String id;
    @ApidocModelProperty(description = "凭证编号")
    private String ticketNo;
    @JsonSerialize(using = DoubleSerialize.class)
    @ApidocModelProperty(description = "凭证金额")
    private Double ticketAllAmount;
    @ApidocModelProperty(description = "开单企业id")
    private String openEnterpriseId;
    @ApidocModelProperty(description = "开单企业名称")
    private String openEnterpriseName;
    @ApidocModelProperty(description = "开单企业统一社会信用代码")
    private String openSocialCreditCode;
    @ApidocModelProperty(description = "转单企业id")
    private String transferEnterpriseId;
    @ApidocModelProperty(description = "转单企业名称")
    private String transferEnterpriseName;
    @ApidocModelProperty(description = "转让方企业社会统一代码")
    private String transferocialCreditCode;
    @ApidocModelProperty(description = "金融机构Id")
    private String instinctyId;
    @ApidocModelProperty(description = "金融机构名称")
    private String instinctyName;
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApidocModelProperty(description = "到期日期", validate = "yyyy-MM-dd")
    private Date expireTime;
    @ApidocModelProperty(description = "付息方式 ：1 融资方付息（默认）2 核心企业付息")
    private Integer paymentMode;
    @ApidocModelProperty(description = "付息方式 ：1 融资方付息（默认）2 核心企业付息")
    private String paymentModeName;

    public String getPaymentModeName() {
        if (null != paymentMode) {
            return PaymentModeEnum.getValue(paymentMode);
        }
        return "";
    }

    @ApidocModelProperty(description = "备注")
    private String remark;
    @ApidocModelProperty(description = "剩余天数")
    private String surplusDays;
    @ApidocModelProperty(description = "我的票据表  原始票 票的 主键id")
    private String ticketOriginId;
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApidocModelProperty(description = "开单日期", validate = "yyyy-MM-dd")
    private Date invoiceTime;
    @ApidocModelProperty(description = "合同编号")
    private String contractNo;


    /**
     * 文件信息
     */
    @ApidocModelProperty(description = "发票信息")
    List<TicketDataEntity> invoiceList = new ArrayList<>();
    @ApidocModelProperty(description = "凭证信息")
    List<TicketDataEntity> proofList = new ArrayList<>();
}
